# -*- coding: utf-8 -*-
# TencentBlueKing is pleased to support the open source community by making
# 蓝鲸智云 - PaaS 平台 (BlueKing - PaaS System) available.
# Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the MIT License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
#     http://opensource.org/licenses/MIT
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
#
# We undertake not to change the open source license (MIT license) applicable
# to the current version of the project delivered to anyone in the future.

# Generated by Django 2.2.17 on 2020-12-10 10:08

from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Cluster',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('region', models.CharField(db_index=True, max_length=32)),
                ('name', models.CharField(help_text='name of the cluster', max_length=32, unique=True)),
                ('description', models.TextField(blank=True, help_text='描述信息')),
                ('is_default', models.NullBooleanField(default=False)),
                ('ingress_config', jsonfield.fields.JSONField(default={})),
                ('annotations', jsonfield.fields.JSONField(default={}, help_text='Annotations are used to add metadata to describe the cluster.')),
                ('ca_data', models.TextField()),
                ('cert_data', models.TextField()),
                ('key_data', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='APIServer',
            fields=[
                ('uuid', models.UUIDField(auto_created=True, default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True, verbose_name='UUID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('host', models.CharField(help_text='API Server 的后端地址', max_length=255)),
                ('overridden_hostname', models.CharField(blank=True, default=None, help_text='在请求该 APIServer 时, 使用该 hostname 替换具体的 backend 中的 hostname', max_length=255, null=True)),
                ('cluster', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='api_servers', to='cluster.Cluster')),
            ],
            options={
                'unique_together': {('cluster', 'host')},
            },
        ),
    ]
